package com.symc.his.api.impl.doctor;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.symc.his.api.base.BaseApiService;
import com.symc.his.api.base.BaseResponse;
import com.symc.his.api.doctor.DoctorReceptionService;
import com.symc.his.api.doctor.dto.req.PatientRegisterReqDTO;
import com.symc.his.api.impl.entity.PatientRegisterDO;
import com.symc.his.api.impl.mapper.PatientRegisterMapper;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @CreateTime: 2023/3/9 22:56
 * @Version:
 * @Since: 1.8
 * @Author: 辛凤文 forward.seen@foxmail.com
 */
@RestController
public class DoctorReceptionServiceImpl extends BaseApiService implements DoctorReceptionService {

    @Resource
    private PatientRegisterMapper patientRegisterMapper;

    @Override public BaseResponse getRegisteredPatientListForDoctor(PatientRegisterReqDTO patientRegisterReqDTO) {
        String regDoctorCode = patientRegisterReqDTO.getRegDoctorCode();
        if (StringUtils.isEmpty(regDoctorCode)) {
            return setResultError("注册医生编码不能为空");
        }
        QueryWrapper<PatientRegisterDO> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("reg_doctor_code",regDoctorCode);
        List<PatientRegisterDO> patients = patientRegisterMapper.selectList(queryWrapper);
        return setResultSuccess(patients);
    }
}